#pragma once
#include "Dx11DemoBase.h"
#include <iostream>
#include<fstream>
#include<sstream>
#include<string>
#include <vector>
#include <math.h>
using namespace std;


struct VertexMesh
{
	XMFLOAT3 pos;
	XMFLOAT2 UV;
	XMFLOAT3 normoal;
};

struct Mesh
{
	vector<VertexMesh> vertexBuff;
	vector<WORD> IndexBuff;
};

class MeshDemo :
	public Dx11DemoBase
{
public:
	XMMATRIX                g_MeshWorld;
	XMMATRIX                g_MeshView;
	XMMATRIX                g_MeshProjection;
	MeshDemo();
	~MeshDemo();

	virtual bool LoadContent() override;


	virtual void UnLoadContent() override;


	virtual void Update(float dt) override;


	virtual void Render() override;

	bool LoadMesh();

	vector<string> split(string str, string pattern);

	vector<string> splitByStr(char str, string pattern);

	Mesh MyMesh;
	ID3D11Buffer *m_pVertexBuffer;
	ID3D11Buffer* m_pIndexBuffer;
	ID3D11InputLayout *m_pInputLayout;
	ID3D11Buffer*   g_pConstantBuffer11;
	ID3D11VertexShader *m_pSolidColorVS;
	ID3D11PixelShader *m_pSolidColorPS;
	ID3D11ShaderResourceView* g_pTextureRV;
	ID3D11SamplerState* g_pSamplerLinear;

	bool isEqule(const VertexMesh& a, const VertexMesh& b);

};

